Sergei Lebedev 421bc73cff
[MLIR] [Python] Fixed a few issues in the type annotations (#183021)
* Removed an explicit `nb::sig` for `static_typeid`. The inferred type
would
work just fine, and unqualified `TypeID`, which was there previously,
only
  really works for core types in the `ir` submodule.
* `DefaultingPyMlir*` helpers also produce qualified types, e.g.
  `_mlir.ir.Location` instead of bare `Location`.
* `ir.*.__enter__` now returns a concrete type instead of `object`, e.g.
  `ir.Context.__enter__` returns `Context`.
* `loc_tracebacks` uses `Generator` as the return type, since this is
what
  `contextmanager` expects in typeshed.
* Changed static methods on subclasses of `DenseElementsAttribute` to
return
  that concrete subclass, instead of `DenseElementsAttribute`.

---------

Co-authored-by: Maksim Levental <maksim.levental@gmail.com>
2026-03-08 13:22:04 +00:00
..