[Mlir-commits] [mlir] 5177676 - Updated MLIR type stubs to work with pytype

Alex Zinenko llvmlistbot at llvm.org
Fri Mar 25 05:38:56 PDT 2022


Author: Sergei Lebedev
Date: 2022-03-25T13:38:49+01:00
New Revision: 5177676261147ef6c930e060a13a895e45bb6af4

URL: https://github.com/llvm/llvm-project/commit/5177676261147ef6c930e060a13a895e45bb6af4
DIFF: https://github.com/llvm/llvm-project/commit/5177676261147ef6c930e060a13a895e45bb6af4.diff

LOG: Updated MLIR type stubs to work with pytype

The diff is big, but there are in fact only three kinds of changes

* ir.py had a synax error -- underminated [
* forward references are unnecessary in .pyi files (see https://github.com/python/typeshed/blob/9a76b13127ffa8365431dcc105fc111cdd267e7e/CONTRIBUTING.md?plain=1#L450-L454)
* methods defined via .def_static() are now decorated with @staticmethod

Reviewed By: ftynse

Differential Revision: https://reviews.llvm.org/D122300

Added: 
    

Modified: 
    mlir/python/mlir/_mlir_libs/_mlir/ir.pyi
    mlir/python/mlir/_mlir_libs/_mlir/passmanager.pyi

Removed: 
    


################################################################################
diff  --git a/mlir/python/mlir/_mlir_libs/_mlir/ir.pyi b/mlir/python/mlir/_mlir_libs/_mlir/ir.pyi
index 8bd9822f4ce9d..5bfb9202ecb8e 100644
--- a/mlir/python/mlir/_mlir_libs/_mlir/ir.pyi
+++ b/mlir/python/mlir/_mlir_libs/_mlir/ir.pyi
@@ -95,31 +95,31 @@ __all__ = [
 
 # Base classes: declared first to simplify declarations below.
 class _OperationBase:
-    def detach_from_parent(self) -> "OpView": ...
+    def detach_from_parent(self) -> OpView: ...
     def get_asm(self, binary: bool = False, large_elements_limit: Optional[int] = None, enable_debug_info: bool = False, pretty_debug_info: bool = False, print_generic_op_form: bool = False, use_local_scope: bool = False, assume_verified: bool = False) -> object: ...
-    def move_after(self, other: "_OperationBase") -> None: ...
-    def move_before(self, other: "_OperationBase") -> None: ...
+    def move_after(self, other: _OperationBase) -> None: ...
+    def move_before(self, other: _OperationBase) -> None: ...
     def print(self, file: Optional[Any] = None, binary: bool = False, large_elements_limit: Optional[int] = None, enable_debug_info: bool = False, pretty_debug_info: bool = False, print_generic_op_form: bool = False, use_local_scope: bool = False, assume_verified: bool = False) -> None: ...
     def verify(self) -> bool: ...
     @overload
-    def __eq__(self, arg0: "_OperationBase") -> bool: ...
+    def __eq__(self, arg0: _OperationBase) -> bool: ...
     @overload
     def __eq__(self, arg0: object) -> bool: ...
     def __hash__(self) -> int: ...
     @property
     def _CAPIPtr(self) -> object: ...
     @property
-    def attributes(self) -> "OpAttributeMap": ...
+    def attributes(self) -> OpAttributeMap: ...
     @property
-    def location(self) -> "Location": ...
+    def location(self) -> Location: ...
     @property
-    def operands(self) -> "OpOperandList": ...
+    def operands(self) -> OpOperandList: ...
     @property
-    def regions(self) -> "RegionSequence": ...
+    def regions(self) -> RegionSequence: ...
     @property
-    def result(self) -> "OpResult": ...
+    def result(self) -> OpResult: ...
     @property
-    def results(self) -> "OpResultList": ...
+    def results(self) -> OpResultList: ...
 
 # TODO: Auto-generated. Audit and fix.
 class AffineExpr:
@@ -154,69 +154,72 @@ class AffineExpr:
     def context(self) -> object: ...
 
 class Attribute:
-    def __init__(self, cast_from_type: "Attribute") -> None: ...
-    def _CAPICreate(self) -> "Attribute": ...
+    def __init__(self, cast_from_type: Attribute) -> None: ...
+    def _CAPICreate(self) -> Attribute: ...
     def dump(self) -> None: ...
     def get_named(self, *args, **kwargs) -> Any: ...
     @staticmethod
-    def parse(asm: str, context: Optional["Context"] = None) -> Any: ...
+    def parse(asm: str, context: Optional[Context] = None) -> Any: ...
     @overload
-    def __eq__(self, arg0: "Attribute") -> bool: ...
+    def __eq__(self, arg0: Attribute) -> bool: ...
     @overload
     def __eq__(self, arg0: object) -> bool: ...
     def __hash__(self) -> int: ...
     @property
     def _CAPIPtr(self) -> object: ...
     @property
-    def context(self) -> "Context": ...
+    def context(self) -> Context: ...
     @property
-    def type(self) -> "Type": ...
+    def type(self) -> Type: ...
 
 class Type:
-    def __init__(self, cast_from_type: "Type") -> None: ...
+    def __init__(self, cast_from_type: Type) -> None: ...
     def _CAPICreate(self) -> Type: ...
     def dump(self) -> None: ...
     @staticmethod
-    def parse(asm: str, context: Optional["Context"] = None) -> "Type": ...
+    def parse(asm: str, context: Optional[Context] = None) -> Type: ...
     @overload
-    def __eq__(self, arg0: "Type") -> bool: ...
+    def __eq__(self, arg0: Type) -> bool: ...
     @overload
     def __eq__(self, arg0: object) -> bool: ...
     def __hash__(self) -> int: ...
     @property
     def _CAPIPtr(self) -> object: ...
     @property
-    def context(self) -> "Context": ...
+    def context(self) -> Context: ...
 
 class Value:
-    def _CAPICreate(self) -> "Value": ...
+    def _CAPICreate(self) -> Value: ...
     def dump(self) -> None: ...
     @overload
-    def __eq__(self, arg0: "Value") -> bool: ...
+    def __eq__(self, arg0: Value) -> bool: ...
     @overload
     def __eq__(self, arg0: object) -> bool: ...
     def __hash__(self) -> int: ...
     @property
     def _CAPIPtr(self) -> object: ...
     @property
-    def context(self) -> "Context": ...
+    def context(self) -> Context: ...
     @property
-    def owner(self) -> "_OperationBase": ...
+    def owner(self) -> _OperationBase: ...
     @property
-    def type(self) -> "Type": ...
+    def type(self) -> Type: ...
 
 
 # Classes with no particular order sensitivity in alpha order.
 # TODO: Auto-generated. Audit and fix.
 class AffineAddExpr(AffineBinaryExpr):
     def __init__(self, expr: AffineExpr) -> None: ...
-    def get(self, *args, **kwargs) -> Any: ...
-    def isinstance(self, *args, **kwargs) -> Any: ...
+    @staticmethod
+    def get(*args, **kwargs) -> AffineAddExpr: ...
+    @staticmethod
+    def isinstance(arg: Any) -> bool: ...
 
 # TODO: Auto-generated. Audit and fix.
 class AffineBinaryExpr(AffineExpr):
     def __init__(self, expr: AffineExpr) -> None: ...
-    def isinstance(self, *args, **kwargs) -> Any: ...
+    @staticmethod
+    def isinstance(arg: Any) -> bool: ...
     @property
     def lhs(self) -> AffineExpr: ...
     @property
@@ -225,22 +228,28 @@ class AffineBinaryExpr(AffineExpr):
 # TODO: Auto-generated. Audit and fix.
 class AffineCeilDivExpr(AffineBinaryExpr):
     def __init__(self, expr: AffineExpr) -> None: ...
-    def get(self, *args, **kwargs) -> Any: ...
-    def isinstance(self, *args, **kwargs) -> Any: ...
+    @staticmethod
+    def get(*args, **kwargs) -> AffineCeilDivExpr: ...
+    @staticmethod
+    def isinstance(arg: Any) -> bool: ...
 
 # TODO: Auto-generated. Audit and fix.
 class AffineConstantExpr(AffineExpr):
     def __init__(self, expr: AffineExpr) -> None: ...
-    def get(self, *args, **kwargs) -> Any: ...
-    def isinstance(self, *args, **kwargs) -> Any: ...
+    @staticmethod
+    def get(*args, **kwargs) -> AffineConstantExpr: ...
+    @staticmethod
+    def isinstance(arg: Any) -> bool: ...
     @property
     def value(self) -> int: ...
 
 # TODO: Auto-generated. Audit and fix.
 class AffineDimExpr(AffineExpr):
     def __init__(self, expr: AffineExpr) -> None: ...
-    def get(self, *args, **kwargs) -> Any: ...
-    def isinstance(self, *args, **kwargs) -> Any: ...
+    @staticmethod
+    def get(*args, **kwargs) -> AffineDimExpr: ...
+    @staticmethod
+    def isinstance(arg: Any) -> bool: ...
     @property
     def position(self) -> int: ...
 
@@ -257,22 +266,29 @@ class AffineExprList:
 # TODO: Auto-generated. Audit and fix.
 class AffineFloorDivExpr(AffineBinaryExpr):
     def __init__(self, expr: AffineExpr) -> None: ...
-    def get(self, *args, **kwargs) -> Any: ...
-    def isinstance(self, *args, **kwargs) -> Any: ...
+    def get(*args, **kwargs) -> AffineFloorDivExpr: ...
+    @staticmethod
+    def isinstance(arg: Any) -> bool: ...
 
 # TODO: Auto-generated. Audit and fix.
 class AffineMap:
     def __init__(self, *args, **kwargs) -> None: ...
     def _CAPICreate(self) -> AffineMap: ...
-    def compress_unused_symbols(self, *args, **kwargs) -> Any: ...
+    @staticmethod
+    def compress_unused_symbols(*args, **kwargs) -> Any: ...
     def dump(self) -> None: ...
-    def get(self, *args, **kwargs) -> Any: ...
-    def get_constant(self, *args, **kwargs) -> Any: ...
-    def get_empty(self, *args, **kwargs) -> Any: ...
-    def get_identity(self, *args, **kwargs) -> Any: ...
-    def get_major_submap(self, n_results: int) -> AffineMap: ...
-    def get_minor_identity(self, *args, **kwargs) -> Any: ...
+    @staticmethod
+    def get(*args, **kwargs) -> AffineMap: ...
+    @staticmethod
+    def get_constant(*args, **kwargs) -> AffineMap: ...
+    @staticmethod
+    def get_empty(*args, **kwargs) -> AffineMap: ...
+    @staticmethod
+    def get_identity(*args, **kwargs) -> AffineMap: ...
+    @staticmethod
+    def get_minor_identity(*args, **kwargs) -> AffineMap: ...
     def get_minor_submap(self, n_results: int) -> AffineMap: ...
+    def get_major_submap(self, n_results: int) -> AffineMap: ...
     def get_permutation(self, *args, **kwargs) -> Any: ...
     def get_submap(self, result_positions: List[int]) -> AffineMap: ...
     def replace(self, expr: AffineExpr, replacement: AffineExpr, n_result_dims: int, n_result_syms: int) -> AffineMap: ...
@@ -301,36 +317,46 @@ class AffineMap:
 # TODO: Auto-generated. Audit and fix.
 class AffineMapAttr(Attribute):
     def __init__(self, cast_from_attr: Attribute) -> None: ...
-    def get(self, *args, **kwargs) -> Any: ...
-    def isinstance(self, *args, **kwargs) -> Any: ...
+    @staticmethod
+    def get(*args, **kwargs) -> AffineMapAttr: ...
+    @staticmethod
+    def isinstance(arg: Any) -> bool: ...
     @property
     def type(self) -> Type: ...
 
 # TODO: Auto-generated. Audit and fix.
 class AffineModExpr(AffineBinaryExpr):
     def __init__(self, expr: AffineExpr) -> None: ...
-    def get(self, *args, **kwargs) -> Any: ...
-    def isinstance(self, *args, **kwargs) -> Any: ...
+    @staticmethod
+    def get(*args, **kwargs) -> AffineModExpr: ...
+    @staticmethod
+    def isinstance(arg: Any) -> bool: ...
 
 # TODO: Auto-generated. Audit and fix.
 class AffineMulExpr(AffineBinaryExpr):
     def __init__(self, expr: AffineExpr) -> None: ...
-    def get(self, *args, **kwargs) -> Any: ...
-    def isinstance(self, *args, **kwargs) -> Any: ...
+    @staticmethod
+    def get(*args, **kwargs) -> AffineMulExpr: ...
+    @staticmethod
+    def isinstance(arg: Any) -> bool: ...
 
 # TODO: Auto-generated. Audit and fix.
 class AffineSymbolExpr(AffineExpr):
     def __init__(self, expr: AffineExpr) -> None: ...
-    def get(self, *args, **kwargs) -> Any: ...
-    def isinstance(self, *args, **kwargs) -> Any: ...
+    @staticmethod
+    def get(*args, **kwargs) -> AffineSymbolExpr: ...
+    @staticmethod
+    def isinstance(arg: Any) -> bool: ...
     @property
     def position(self) -> int: ...
 
 # TODO: Auto-generated. Audit and fix.
 class ArrayAttr(Attribute):
     def __init__(self, cast_from_attr: Attribute) -> None: ...
-    def get(self, *args, **kwargs) -> Any: ...
-    def isinstance(self, *args, **kwargs) -> Any: ...
+    @staticmethod
+    def get(*args, **kwargs) -> ArrayAttr: ...
+    @staticmethod
+    def isinstance(arg: Any) -> bool: ...
     def __add__(self, arg0: list) -> ArrayAttr: ...
     def __getitem__(self, arg0: int) -> Attribute: ...
     def __iter__(self) -> Any: ...
@@ -347,64 +373,69 @@ class ArrayAttributeIterator:
 # TODO: Auto-generated. Audit and fix.
 class BF16Type(Type):
     def __init__(self, cast_from_type: Type) -> None: ...
-    def get(self, *args, **kwargs) -> Any: ...
-    def isinstance(self, *args, **kwargs) -> Any: ...
+    @staticmethod
+    def get(*args, **kwargs) -> BF16Type: ...
+    @staticmethod
+    def isinstance(arg: Any) -> bool: ...
 
 class Block:
     __hash__: ClassVar[None] = ...
     def append(self, operation: _OperationBase) -> None: ...
-    def create_after(self, *args: "Type") -> "Block": ...
+    def create_after(self, *args: Type) -> Block: ...
     @staticmethod
-    def create_at_start(parent: "Region", arg_types: List["Type"]) -> "Block": ...
-    def create_before(self, *args: "Type") -> "Block": ...
+    def create_at_start(parent: Region, arg_types: List[Type]) -> Block: ...
+    def create_before(self, *args: Type) -> Block: ...
     @overload
-    def __eq__(self, arg0: "Block") -> bool: ...
+    def __eq__(self, arg0: Block) -> bool: ...
     @overload
     def __eq__(self, arg0: object) -> bool: ...
     def __iter__(self) -> Any: ...
     @property
-    def arguments(self) -> "BlockArgumentList": ...
+    def arguments(self) -> BlockArgumentList: ...
     @property
-    def operations(self) -> "OperationList": ...
+    def operations(self) -> OperationList: ...
     @property
-    def owner(self) -> "OpView": ...
+    def owner(self) -> OpView: ...
     @property
-    def region(self) -> "Region": ...
+    def region(self) -> Region: ...
 
 class BlockArgument(Value):
-    def isinstance(self, *args, **kwargs) -> Any: ...
-    def set_type(self, type: "Type") -> None: ...
+    @staticmethod
+    def isinstance(arg: Any) -> bool: ...
+    def set_type(self, type: Type) -> None: ...
     @property
     def arg_number(self) -> int: ...
     @property
-    def owner(self) -> "Block": ...
+    def owner(self) -> Block: ...
 
 class BlockArgumentList:
-    def __add__(self, arg0: "BlockArgumentList") -> List["BlockArgument"]: ...
+    def __add__(self, arg0: BlockArgumentList) -> List[BlockArgument]: ...
     @overload
-    def __getitem__(self, arg0: int) -> "BlockArgument": ...
+    def __getitem__(self, arg0: int) -> BlockArgument: ...
     @overload
-    def __getitem__(self, arg0: slice) -> "BlockArgumentList": ...
+    def __getitem__(self, arg0: slice) -> BlockArgumentList: ...
     def __len__(self) -> int: ...
     @property
-    def types(self) -> List["Type"]: ...
+    def types(self) -> List[Type]: ...
 
 class BlockIterator:
     def __init__(self, *args, **kwargs) -> None: ...
-    def __iter__(self) -> "BlockIterator": ...
-    def __next__(self) -> "Block": ...
+    def __iter__(self) -> BlockIterator: ...
+    def __next__(self) -> Block: ...
 
 class BlockList:
-    def append(self, *args) -> "Block": ...
-    def __getitem__(self, arg0: int) -> "Block": ...
-    def __iter__(self) -> "BlockIterator": ...
+    def append(self, *args) -> Block: ...
+    def __getitem__(self, arg0: int) -> Block: ...
+    def __iter__(self) -> BlockIterator: ...
     def __len__(self) -> int: ...
 
 # TODO: Auto-generated. Audit and fix.
 class BoolAttr(Attribute):
     def __init__(self, cast_from_attr: Attribute) -> None: ...
-    def get(self, *args, **kwargs) -> Any: ...
-    def isinstance(self, *args, **kwargs) -> Any: ...
+    @staticmethod
+    def get(*args, **kwargs) -> BoolAttr: ...
+    @staticmethod
+    def isinstance(arg: Any) -> bool: ...
     @property
     def type(self) -> Type: ...
     @property
@@ -413,40 +444,45 @@ class BoolAttr(Attribute):
 # TODO: Auto-generated. Audit and fix.
 class ComplexType(Type):
     def __init__(self, cast_from_type: Type) -> None: ...
-    def get(self, *args, **kwargs) -> Any: ...
-    def isinstance(self, *args, **kwargs) -> Any: ...
+    @staticmethod
+    def get(*args, **kwargs) -> ComplexType: ...
+    @staticmethod
+    def isinstance(arg: Any) -> bool: ...
     @property
     def element_type(self) -> Type: ...
 
 class Context:
-    current: ClassVar["Context"] = ...  # read-only
+    current: ClassVar[Context] = ...  # read-only
     allow_unregistered_dialects: bool
     def __init__(self) -> None: ...
     def _CAPICreate(self) -> object: ...
-    def _get_context_again(self) -> "Context": ...
+    def _get_context_again(self) -> Context: ...
     @staticmethod
     def _get_live_count() -> int: ...
     def _get_live_module_count(self) -> int: ...
     def _get_live_operation_count(self) -> int: ...
-    def attach_diagnostic_handler(self, callback: Callable[["Diagnostic"], bool]) -> "DiagnosticHandler": ...
+    def attach_diagnostic_handler(self, callback: Callable[[Diagnostic], bool]) -> DiagnosticHandler: ...
     def enable_multithreading(self, enable: bool) -> None: ...
-    def get_dialect_descriptor(dialect_name: str) -> "DialectDescriptor": ...
+    def get_dialect_descriptor(dialect_name: str) -> DialectDescriptor: ...
     def is_registered_operation(self, operation_name: str) -> bool: ...
-    def __enter__(self) -> "Context": ...
+    def __enter__(self) -> Context: ...
     def __exit__(self, arg0: object, arg1: object, arg2: object) -> None: ...
     @property
     def _CAPIPtr(self) -> object: ...
     @property
-    def d(self) -> "Dialects": ...
+    def d(self) -> Dialects: ...
     @property
-    def dialects(self) -> "Dialects": ...
+    def dialects(self) -> Dialects: ...
 
 # TODO: Auto-generated. Audit and fix.
 class DenseElementsAttr(Attribute):
     def __init__(self, cast_from_attr: Attribute) -> None: ...
-    def get(self, *args, **kwargs) -> Any: ...
-    def get_splat(self, *args, **kwargs) -> Any: ...
-    def isinstance(self, *args, **kwargs) -> Any: ...
+    @staticmethod
+    def get(*args, **kwargs) -> DenseElementsAttr: ...
+    @staticmethod
+    def get_splat(*args, **kwargs) -> Any: ...
+    @staticmethod
+    def isinstance(arg: Any) -> bool: ...
     def __len__(self) -> int: ...
     @property
     def is_splat(self) -> bool: ...
@@ -456,7 +492,10 @@ class DenseElementsAttr(Attribute):
 # TODO: Auto-generated. Audit and fix.
 class DenseFPElementsAttr(DenseElementsAttr):
     def __init__(self, cast_from_attr: Attribute) -> None: ...
-    def isinstance(self, *args, **kwargs) -> Any: ...
+    @staticmethod
+    def get(*args, **kwargs) -> DenseFPElementsAttr: ...
+    @staticmethod
+    def isinstance(arg: Any) -> bool: ...
     def __getitem__(self, arg0: int) -> float: ...
     @property
     def type(self) -> Type: ...
@@ -464,15 +503,18 @@ class DenseFPElementsAttr(DenseElementsAttr):
 # TODO: Auto-generated. Audit and fix.
 class DenseIntElementsAttr(DenseElementsAttr):
     def __init__(self, cast_from_attr: Attribute) -> None: ...
-    def isinstance(self, *args, **kwargs) -> Any: ...
+    @staticmethod
+    def get(*args, **kwargs) -> DenseIntElementsAttr: ...
+    @staticmethod
+    def isinstance(arg: Any) -> bool: ...
     def __getitem__(self, arg0: int) -> int: ...
     @property
     def type(self) -> Type: ...
 
 class Dialect:
-    def __init__(self, descriptor: "DialectDescriptor") -> None: ...
+    def __init__(self, descriptor: DialectDescriptor) -> None: ...
     @property
-    def descriptor(self) -> "DialectDescriptor": ...
+    def descriptor(self) -> DialectDescriptor: ...
 
 class DialectDescriptor:
     @property
@@ -480,18 +522,18 @@ class DialectDescriptor:
 
 class Dialects:
     def __init__(self, *args, **kwargs) -> None: ...
-    def __getattr__(self, arg0: str) -> "Dialect": ...
-    def __getitem__(self, arg0: str) -> "Dialect": ...
+    def __getattr__(self, arg0: str) -> Dialect: ...
+    def __getitem__(self, arg0: str) -> Dialect: ...
 
 class Diagnostic:
     @property
-    def severity(self) -> "DiagnosticSeverity": ...
+    def severity(self) -> DiagnosticSeverity: ...
     @property
-    def location(self) -> "Location": ...
+    def location(self) -> Location: ...
     @property
     def message(self) -> str: ...
     @property
-    def notes(self) -> Tuple["Diagnostic"]: ...
+    def notes(self) -> Tuple[Diagnostic]: ...
 
 class DiagnosticHandler:
     def detach(self) -> None: ...
@@ -499,20 +541,22 @@ class DiagnosticHandler:
     def attached(self) -> bool: ...
     @property
     def had_error(self) -> bool: ...
-    def __enter__(self) -> "DiagnosticHandler": ...
+    def __enter__(self) -> DiagnosticHandler: ...
     def __exit__(self, arg0: object, arg1: object, arg2: object) -> None: ...
 
 class DiagnosticSeverity:
-    ERROR: "DiagnosticSeverity"
-    WARNING: "DiagnosticSeverity"
-    NOTE: "DiagnosticSeverity"
-    REMARK: "DiagnosticSeverity"
+    ERROR: DiagnosticSeverity
+    WARNING: DiagnosticSeverity
+    NOTE: DiagnosticSeverity
+    REMARK: DiagnosticSeverity
 
 # TODO: Auto-generated. Audit and fix.
 class DictAttr(Attribute):
     def __init__(self, cast_from_attr: Attribute) -> None: ...
-    def get(self, *args, **kwargs) -> Any: ...
-    def isinstance(self, *args, **kwargs) -> Any: ...
+    @staticmethod
+    def get(*args, **kwargs) -> DictAttr: ...
+    @staticmethod
+    def isinstance(arg: Any) -> bool: ...
     def __contains__(self, arg0: str) -> bool: ...
     @overload
     def __getitem__(self, arg0: str) -> Attribute: ...
@@ -525,26 +569,34 @@ class DictAttr(Attribute):
 # TODO: Auto-generated. Audit and fix.
 class F16Type(Type):
     def __init__(self, cast_from_type: Type) -> None: ...
-    def get(self, *args, **kwargs) -> Any: ...
-    def isinstance(self, *args, **kwargs) -> Any: ...
+    @staticmethod
+    def get(*args, **kwargs) -> F16Type: ...
+    @staticmethod
+    def isinstance(arg: Any) -> bool: ...
 
 # TODO: Auto-generated. Audit and fix.
 class F32Type(Type):
     def __init__(self, cast_from_type: Type) -> None: ...
-    def get(self, *args, **kwargs) -> Any: ...
-    def isinstance(self, *args, **kwargs) -> Any: ...
+    @staticmethod
+    def get(*args, **kwargs) -> F32Type: ...
+    @staticmethod
+    def isinstance(arg: Any) -> bool: ...
 
 # TODO: Auto-generated. Audit and fix.
 class F64Type(Type):
     def __init__(self, cast_from_type: Type) -> None: ...
-    def get(self, *args, **kwargs) -> Any: ...
-    def isinstance(self, *args, **kwargs) -> Any: ...
+    @staticmethod
+    def get(*args, **kwargs) -> F64Type: ...
+    @staticmethod
+    def isinstance(arg: Any) -> bool: ...
 
 # TODO: Auto-generated. Audit and fix.
 class FlatSymbolRefAttr(Attribute):
     def __init__(self, cast_from_attr: Attribute) -> None: ...
-    def get(self, *args, **kwargs) -> Any: ...
-    def isinstance(self, *args, **kwargs) -> Any: ...
+    @staticmethod
+    def get(*args, **kwargs) -> FlatSymbolRefAttr: ...
+    @staticmethod
+    def isinstance(arg: Any) -> bool: ...
     @property
     def type(self) -> Type: ...
     @property
@@ -553,10 +605,14 @@ class FlatSymbolRefAttr(Attribute):
 # TODO: Auto-generated. Audit and fix.
 class FloatAttr(Attribute):
     def __init__(self, cast_from_attr: Attribute) -> None: ...
-    def get(self, *args, **kwargs) -> Any: ...
-    def get_f32(self, *args, **kwargs) -> Any: ...
-    def get_f64(self, *args, **kwargs) -> Any: ...
-    def isinstance(self, *args, **kwargs) -> Any: ...
+    @staticmethod
+    def get(*args, **kwargs) -> FloatAttr: ...
+    @staticmethod
+    def get_f32(*args, **kwargs) -> FloatAttr: ...
+    @staticmethod
+    def get_f64(*args, **kwargs) -> FloatAttr: ...
+    @staticmethod
+    def isinstance(arg: Any) -> bool: ...
     @property
     def type(self) -> Type: ...
     @property
@@ -565,8 +621,10 @@ class FloatAttr(Attribute):
 # TODO: Auto-generated. Audit and fix.
 class FunctionType(Type):
     def __init__(self, cast_from_type: Type) -> None: ...
-    def get(self, *args, **kwargs) -> Any: ...
-    def isinstance(self, *args, **kwargs) -> Any: ...
+    @staticmethod
+    def get(*args, **kwargs) -> FunctionType: ...
+    @staticmethod
+    def isinstance(arg: Any) -> bool: ...
     @property
     def inputs(self) -> list: ...
     @property
@@ -575,38 +633,42 @@ class FunctionType(Type):
 # TODO: Auto-generated. Audit and fix.
 class IndexType(Type):
     def __init__(self, cast_from_type: Type) -> None: ...
-    def get(self, *args, **kwargs) -> Any: ...
-    def isinstance(self, *args, **kwargs) -> Any: ...
+    @staticmethod
+    def get(*args, **kwargs) -> IndexType: ...
+    @staticmethod
+    def isinstance(arg: Any) -> bool: ...
 
 class InferTypeOpInterface:
-    def __init__(self, object: object, context: Optional["Context"] = None) -> None: ...
-    def inferReturnTypes(self, operands: Optional[List["Value"]] = None, attributes: Optional["Attribute"] = None, regions: Optional[List["Region"]] = None, context: Optional["Context"] = None, loc: Optional["Location"] = None) -> List[Type]: ...
+    def __init__(self, object: object, context: Optional[Context] = None) -> None: ...
+    def inferReturnTypes(self, operands: Optional[List[Value]] = None, attributes: Optional[Attribute] = None, regions: Optional[List[Region]] = None, context: Optional[Context] = None, loc: Optional[Location] = None) -> List[Type]: ...
     @property
-    def operation(self) -> "_OperationBase": ...
+    def operation(self) -> Operation: ...
     @property
-    def opview(self) -> "OpView": ...
+    def opview(self) -> OpView: ...
 
 class InsertionPoint:
-    current: ClassVar["InsertionPoint"] = ...  # read-only
+    current: ClassVar[InsertionPoint] = ...  # read-only
     @overload
-    def __init__(self, block: "Block") -> None: ...
+    def __init__(self, block: Block) -> None: ...
     @overload
-    def __init__(self, beforeOperation: "_OperationBase") -> None: ...
+    def __init__(self, beforeOperation: _OperationBase) -> None: ...
     @staticmethod
-    def at_block_begin(block: "Block") -> "InsertionPoint": ...
+    def at_block_begin(block: Block) -> InsertionPoint: ...
     @staticmethod
-    def at_block_terminator(block: "Block") -> "InsertionPoint": ...
-    def insert(self, operation: "_OperationBase") -> None: ...
-    def __enter__(self) -> "InsertionPoint": ...
+    def at_block_terminator(block: Block) -> InsertionPoint: ...
+    def insert(self, operation: _OperationBase) -> None: ...
+    def __enter__(self) -> InsertionPoint: ...
     def __exit__(self, arg0: object, arg1: object, arg2: object) -> None: ...
     @property
-    def block(self) -> "Block": ...
+    def block(self) -> Block: ...
 
 # TODO: Auto-generated. Audit and fix.
 class IntegerAttr(Attribute):
     def __init__(self, cast_from_attr: Attribute) -> None: ...
-    def get(self, *args, **kwargs) -> Any: ...
-    def isinstance(self, *args, **kwargs) -> Any: ...
+    @staticmethod
+    def get(*args, **kwargs) -> IntegerAttr: ...
+    @staticmethod
+    def isinstance(arg: Any) -> bool: ...
     @property
     def type(self) -> Type: ...
     @property
@@ -617,8 +679,10 @@ class IntegerSet:
     def __init__(self, *args, **kwargs) -> None: ...
     def _CAPICreate(self) -> IntegerSet: ...
     def dump(self) -> None: ...
-    def get(self, *args, **kwargs) -> Any: ...
-    def get_empty(self, *args, **kwargs) -> Any: ...
+    @staticmethod
+    def get(*args, **kwargs) -> IntegerSet: ...
+    @staticmethod
+    def get_empty(*args, **kwargs) -> IntegerSet: ...
     def get_replaced(self, dim_exprs: list, symbol_exprs: list, num_result_dims: int, num_result_symbols: int) -> IntegerSet: ...
     @overload
     def __eq__(self, arg0: IntegerSet) -> bool: ...
@@ -665,10 +729,14 @@ class IntegerSetConstraintList:
 # TODO: Auto-generated. Audit and fix.
 class IntegerType(Type):
     def __init__(self, cast_from_type: Type) -> None: ...
-    def get_signed(self, *args, **kwargs) -> Any: ...
-    def get_signless(self, *args, **kwargs) -> Any: ...
-    def get_unsigned(self, *args, **kwargs) -> Any: ...
-    def isinstance(self, *args, **kwargs) -> Any: ...
+    @staticmethod
+    def get_signed(*args, **kwargs) -> IntegerType: ...
+    @staticmethod
+    def get_signless(*args, **kwargs) -> IntegerType: ...
+    @staticmethod
+    def get_unsigned(*args, **kwargs) -> IntegerType: ...
+    @staticmethod
+    def isinstance(arg: Any) -> bool: ...
     @property
     def is_signed(self) -> bool: ...
     @property
@@ -679,35 +747,37 @@ class IntegerType(Type):
     def width(self) -> int: ...
 
 class Location:
-    current: ClassVar["Location"] = ...  # read-only
+    current: ClassVar[Location] = ...  # read-only
     __hash__: ClassVar[None] = ...
-    def _CAPICreate(self) -> "Location": ...
+    def _CAPICreate(self) -> Location: ...
     @staticmethod
-    def callsite(callee: "Location", frames: Sequence["Location"], context: Optional["Context"] = None) -> "Location": ...
+    def callsite(callee: Location, frames: Sequence[Location], context: Optional[Context] = None) -> Location: ...
     @staticmethod
-    def file(filename: str, line: int, col: int, context: Optional["Context"] = None) -> "Location": ...
+    def file(filename: str, line: int, col: int, context: Optional[Context] = None) -> Location: ...
     @staticmethod
-    def fused(locations: Sequence["Location"], metadata: Optional["Attribute"] = None, context: Optional["Context"] = None) -> "Location": ...
+    def fused(locations: Sequence[Location], metadata: Optional[Attribute] = None, context: Optional[Context] = None) -> Location: ...
     @staticmethod
-    def name(name: str, childLoc: Optional["Location"] = None, context: Optional["Context"] = None) -> "Location": ...
+    def name(name: str, childLoc: Optional[Location] = None, context: Optional[Context] = None) -> Location: ...
     @staticmethod
-    def unknown(context: Optional["Context"] = None) -> Any: ...
-    def __enter__(self) -> "Location": ...
+    def unknown(context: Optional[Context] = None) -> Any: ...
+    def __enter__(self) -> Location: ...
     @overload
-    def __eq__(self, arg0: "Location") -> bool: ...
+    def __eq__(self, arg0: Location) -> bool: ...
     @overload
     def __eq__(self, arg0: object) -> bool: ...
     def __exit__(self, arg0: object, arg1: object, arg2: object) -> None: ...
     @property
     def _CAPIPtr(self) -> object: ...
     @property
-    def context(self) -> "Context": ...
+    def context(self) -> Context: ...
 
 # TODO: Auto-generated. Audit and fix.
 class MemRefType(ShapedType):
     def __init__(self, cast_from_type: Type) -> None: ...
-    def get(self, *args, **kwargs) -> Any: ...
-    def isinstance(self, *args, **kwargs) -> Any: ...
+    @staticmethod
+    def get(*args, **kwargs) -> MemRefType: ...
+    @staticmethod
+    def isinstance(arg: Any) -> bool: ...
     @property
     def affine_map(self) -> AffineMap: ...
     @property
@@ -717,143 +787,148 @@ class MemRefType(ShapedType):
 
 class Module:
     def _CAPICreate(self) -> object: ...
-    def create(loc: Optional["Location"] = None) -> "Module": ...
+    def create(loc: Optional[Location] = None) -> Module: ...
     def dump(self) -> None: ...
     @staticmethod
-    def parse(asm: str, context: Optional[Context] = None) -> "Module": ...
+    def parse(asm: str, context: Optional[Context] = None) -> Module: ...
     @property
     def _CAPIPtr(self) -> object: ...
     @property
-    def body(self) -> "Block": ...
+    def body(self) -> Block: ...
     @property
     def context(self) -> object: ...
     @property
-    def operation(self) -> "_OperationBase": ...
+    def operation(self) -> Operation: ...
 
 class NamedAttribute:
     @property
-    def attr(self) -> "Attribute": ...
+    def attr(self) -> Attribute: ...
     @property
     def name(self) -> str: ...
 
 # TODO: Auto-generated. Audit and fix.
 class NoneType(Type):
     def __init__(self, cast_from_type: Type) -> None: ...
-    def get(self, *args, **kwargs) -> Any: ...
-    def isinstance(self, *args, **kwargs) -> Any: ...
+    @staticmethod
+    def get(*args, **kwargs) -> NoneType: ...
+    @staticmethod
+    def isinstance(arg: Any) -> bool: ...
 
 class OpAttributeMap:
     def __contains__(self, arg0: str) -> bool: ...
     def __delitem__(self, arg0: str) -> None: ...
     @overload
-    def __getitem__(self, arg0: str) -> "Attribute": ...
+    def __getitem__(self, arg0: str) -> Attribute: ...
     @overload
-    def __getitem__(self, arg0: int) -> "NamedAttribute": ...
+    def __getitem__(self, arg0: int) -> NamedAttribute: ...
     def __len__(self) -> int: ...
-    def __setitem__(self, arg0: str, arg1: "Attribute") -> None: ...
+    def __setitem__(self, arg0: str, arg1: Attribute) -> None: ...
 
 class OpOperandList:
-    def __add__(self, arg0: "OpOperandList") -> List[Value]: ...
+    def __add__(self, arg0: OpOperandList) -> List[Value]: ...
     @overload
     def __getitem__(self, arg0: int) -> Value: ...
     @overload
-    def __getitem__(self, arg0: slice) -> "OpOperandList": ...
+    def __getitem__(self, arg0: slice) -> OpOperandList: ...
     def __len__(self) -> int: ...
     def __setitem__(self, arg0: int, arg1: Value) -> None: ...
 
 class OpResult(Value):
     def __init__(self, value: Value) -> None: ...
-    def isinstance(self, *args, **kwargs) -> Any: ...
+    @staticmethod
+    def isinstance(arg: Any) -> bool: ...
     @property
-    def owner(self) -> "_OperationBase": ...
+    def owner(self) -> _OperationBase: ...
     @property
     def result_number(self) -> int: ...
 
 class OpResultList:
-    def __add__(self, arg0: "OpResultList") -> List["OpResult"]: ...
+    def __add__(self, arg0: OpResultList) -> List[OpResult]: ...
     @overload
-    def __getitem__(self, arg0: int) -> "OpResult": ...
+    def __getitem__(self, arg0: int) -> OpResult: ...
     @overload
-    def __getitem__(self, arg0: slice) -> "OpResultList": ...
+    def __getitem__(self, arg0: slice) -> OpResultList: ...
     def __len__(self) -> int: ...
     @property
-    def types(self) -> List["Type"]: ...
+    def types(self) -> List[Type]: ...
 
 class OpView(_OperationBase):
     _ODS_OPERAND_SEGMENTS: ClassVar[None] = ...
     _ODS_REGIONS: ClassVar[tuple] = ...
     _ODS_RESULT_SEGMENTS: ClassVar[None] = ...
-    def __init__(self, operation: "_OperationBase") -> None: ...
+    def __init__(self, operation: _OperationBase) -> None: ...
     @classmethod
-    def build_generic(cls, results: Optional[Sequence["Type"]] = None,
-        operands: Optional[Sequence["Value"]] = None,
-        attributes: Optional[Dict[str, "Attribute"]] = None,
-        successors: Optional[Sequence["Block"]] = None,
+    def build_generic(cls, results: Optional[Sequence[Type]] = None,
+        operands: Optional[Sequence[Value]] = None,
+        attributes: Optional[Dict[str, Attribute]] = None,
+        successors: Optional[Sequence[Block]] = None,
         regions: Optional[int] = None,
-        loc: Optional["Location"] = None,
-        ip: Optional["InsertionPoint"] = None) -> "_OperationBase": ...
+        loc: Optional[Location] = None,
+        ip: Optional[InsertionPoint] = None) -> _OperationBase: ...
     @property
-    def context(self) -> "Context": ...
+    def context(self) -> Context: ...
     @property
-    def operation(self) -> "_OperationBase": ...
+    def operation(self) -> _OperationBase: ...
 
 class Operation(_OperationBase):
     def _CAPICreate(self) -> object: ...
     @staticmethod
-    def create(name: str, results: Optional[Sequence["Type"]] = None,
-        operands: Optional[Sequence["Value"]] = None,
-        attributes: Optional[Dict[str, "Attribute"]] = None,
-        successors: Optional[Sequence["Block"]] = None,
+    def create(name: str, results: Optional[Sequence[Type]] = None,
+        operands: Optional[Sequence[Value]] = None,
+        attributes: Optional[Dict[str, Attribute]] = None,
+        successors: Optional[Sequence[Block]] = None,
         regions: int = 0,
-        loc: Optional["Location"] = None,
-        ip: Optional["InsertionPoint"] = None) -> "_OperationBase": ...
+        loc: Optional[Location] = None,
+        ip: Optional[InsertionPoint] = None) -> _OperationBase: ...
     def erase(self) -> None: ...
     @property
     def _CAPIPtr(self) -> object: ...
     @property
-    def context(self) -> "Context": ...
+    def context(self) -> Context: ...
     @property
     def name(self) -> str: ...
     @property
-    def opview(self) -> "OpView": ...
+    def opview(self) -> OpView: ...
     @property
-    def parent(self) -> Optional["_OperationBase"]: ...
+    def parent(self) -> Optional[_OperationBase]: ...
 
 class OperationIterator:
-    def __iter__(self) -> "OperationIterator": ...
-    def __next__(self) -> "OpView": ...
+    def __iter__(self) -> OperationIterator: ...
+    def __next__(self) -> OpView: ...
 
 class OperationList:
-    def __getitem__(self, arg0: int) -> "OpView": ...
-    def __iter__(self) -> "OperationIterator": ...
+    def __getitem__(self, arg0: int) -> OpView: ...
+    def __iter__(self) -> OperationIterator: ...
     def __len__(self) -> int: ...
 
 # TODO: Auto-generated. Audit and fix.
 class RankedTensorType(ShapedType):
     def __init__(self, cast_from_type: Type) -> None: ...
-    def get(self, *args, **kwargs) -> Any: ...
-    def isinstance(self, *args, **kwargs) -> Any: ...
+    @staticmethod
+    def get(*args, **kwargs) -> RankedTensorType: ...
+    @staticmethod
+    def isinstance(arg: Any) -> bool: ...
     @property
     def encoding(self) -> Optional[Attribute]: ...
 
 class Region:
     __hash__: ClassVar[None] = ...
     @overload
-    def __eq__(self, arg0: "Region") -> bool: ...
+    def __eq__(self, arg0: Region) -> bool: ...
     @overload
     def __eq__(self, arg0: object) -> bool: ...
-    def __iter__(self) -> "BlockIterator": ...
+    def __iter__(self) -> BlockIterator: ...
     @property
-    def blocks(self) -> "BlockList": ...
+    def blocks(self) -> BlockList: ...
     @property
-    def owner(self) -> "OpView": ...
+    def owner(self) -> OpView: ...
 
 class RegionIterator:
-    def __iter__(self) -> "RegionIterator": ...
-    def __next__(self) -> "Region": ...
+    def __iter__(self) -> RegionIterator: ...
+    def __next__(self) -> Region: ...
 
 class RegionSequence:
-    def __getitem__(self, arg0: int) -> "Region": ...
+    def __getitem__(self, arg0: int) -> Region: ...
     def __len__(self) -> int: ...
 
 # TODO: Auto-generated. Audit and fix.
@@ -863,7 +938,8 @@ class ShapedType(Type):
     def is_dynamic_dim(self, dim: int) -> bool: ...
     def is_dynamic_size(self, *args, **kwargs) -> Any: ...
     def is_dynamic_stride_or_offset(self, dim_size: int) -> bool: ...
-    def isinstance(self, *args, **kwargs) -> Any: ...
+    @staticmethod
+    def isinstance(arg: Any) -> bool: ...
     @property
     def element_type(self) -> Type: ...
     @property
@@ -878,9 +954,12 @@ class ShapedType(Type):
 # TODO: Auto-generated. Audit and fix.
 class StringAttr(Attribute):
     def __init__(self, cast_from_attr: Attribute) -> None: ...
-    def get(self, *args, **kwargs) -> Any: ...
-    def get_typed(self, *args, **kwargs) -> Any: ...
-    def isinstance(self, *args, **kwargs) -> Any: ...
+    @staticmethod
+    def get(*args, **kwargs) -> Any: ...
+    @staticmethod
+    def get_typed(*args, **kwargs) -> Any: ...
+    @staticmethod
+    def isinstance(arg: Any) -> bool: ...
     @property
     def type(self) -> Type: ...
     @property
@@ -901,25 +980,29 @@ class SymbolTable:
     @staticmethod
     def set_visibility(symbol: _OperationBase, visibility: str) -> None: ...
     @staticmethod
-    def walk_symbol_tables(from_op: _OperationBase, all_sym_uses_visible: bool, callback: Callable[[_OperationBase, bool], None) -> None: ...
+    def walk_symbol_tables(from_op: _OperationBase, all_sym_uses_visible: bool, callback: Callable[[_OperationBase, bool], None]) -> None: ...
     def __contains__(self, arg0: str) -> bool: ...
     def __delitem__(self, arg0: str) -> None: ...
-    def __getitem__(self, arg0: str) -> "OpView": ...
+    def __getitem__(self, arg0: str) -> OpView: ...
 
 # TODO: Auto-generated. Audit and fix.
 class TupleType(Type):
     def __init__(self, cast_from_type: Type) -> None: ...
-    def get_tuple(self, *args, **kwargs) -> Any: ...
+    @staticmethod
+    def get_tuple(*args, **kwargs) -> TupleType: ...
     def get_type(self, pos: int) -> Type: ...
-    def isinstance(self, *args, **kwargs) -> Any: ...
+    @staticmethod
+    def isinstance(arg: Any) -> bool: ...
     @property
     def num_types(self) -> int: ...
 
 # TODO: Auto-generated. Audit and fix.
 class TypeAttr(Attribute):
     def __init__(self, cast_from_attr: Attribute) -> None: ...
-    def get(self, *args, **kwargs) -> Any: ...
-    def isinstance(self, *args, **kwargs) -> Any: ...
+    @staticmethod
+    def get(*args, **kwargs) -> Any: ...
+    @staticmethod
+    def isinstance(arg: Any) -> bool: ...
     @property
     def type(self) -> Type: ...
     @property
@@ -928,30 +1011,38 @@ class TypeAttr(Attribute):
 # TODO: Auto-generated. Audit and fix.
 class UnitAttr(Attribute):
     def __init__(self, cast_from_attr: Attribute) -> None: ...
-    def get(self, *args, **kwargs) -> Any: ...
-    def isinstance(self, *args, **kwargs) -> Any: ...
+    @staticmethod
+    def get(*args, **kwargs) -> Any: ...
+    @staticmethod
+    def isinstance(arg: Any) -> bool: ...
     @property
     def type(self) -> Type: ...
 
 # TODO: Auto-generated. Audit and fix.
 class UnrankedMemRefType(ShapedType):
     def __init__(self, cast_from_type: Type) -> None: ...
-    def get(self, *args, **kwargs) -> Any: ...
-    def isinstance(self, *args, **kwargs) -> Any: ...
+    @staticmethod
+    def get(*args, **kwargs) -> UnrankedMemRefType: ...
+    @staticmethod
+    def isinstance(arg: Any) -> bool: ...
     @property
     def memory_space(self) -> Attribute: ...
 
 # TODO: Auto-generated. Audit and fix.
 class UnrankedTensorType(ShapedType):
     def __init__(self, cast_from_type: Type) -> None: ...
-    def get(self, *args, **kwargs) -> Any: ...
-    def isinstance(self, *args, **kwargs) -> Any: ...
+    @staticmethod
+    def get(*args, **kwargs) -> UnrankedTensorType: ...
+    @staticmethod
+    def isinstance(arg: Any) -> bool: ...
 
 # TODO: Auto-generated. Audit and fix.
 class VectorType(ShapedType):
     def __init__(self, cast_from_type: Type) -> None: ...
-    def get(self, *args, **kwargs) -> Any: ...
-    def isinstance(self, *args, **kwargs) -> Any: ...
+    @staticmethod
+    def get(*args, **kwargs) -> VectorType: ...
+    @staticmethod
+    def isinstance(arg: Any) -> bool: ...
 
 class _GlobalDebug:
     flag: ClassVar[bool] = ...

diff  --git a/mlir/python/mlir/_mlir_libs/_mlir/passmanager.pyi b/mlir/python/mlir/_mlir_libs/_mlir/passmanager.pyi
index 728f46418c511..44d22255e3110 100644
--- a/mlir/python/mlir/_mlir_libs/_mlir/passmanager.pyi
+++ b/mlir/python/mlir/_mlir_libs/_mlir/passmanager.pyi
@@ -19,7 +19,7 @@ class PassManager:
     def enable_ir_printing(self) -> None: ...
     def enable_verifier(self, enable: bool) -> None: ...
     @staticmethod
-    def parse(pipeline: str, context: Optional[_ir.Context] = None) -> "PassManager": ...
+    def parse(pipeline: str, context: Optional[_ir.Context] = None) -> PassManager: ...
     def run(self, module: _ir.Module) -> None: ...
     @property
     def _CAPIPtr(self) -> object: ...


        


More information about the Mlir-commits mailing list