This allows these containers to be used in `match` statements, which allows extracting properties and asserting a shape at the same time. It seems to be only possible, to match as _either_ a `Mapping` _or_ a `Sequence`, so the `OpAttributeMap` is only a `Mapping`. I couldn't find a way to make these C++ based types properly inherit from `Sequence` or `Mapping`, so the Mixins are not provided (nanobind only allows C++ parent classes, modifying `__base__` complains about differing destructors). `OpAttributeMap` was lacking the `get` method, so I simply copied it from `collections.abc.Mapping`. When writing the tests i ran into the error, that I wrote `func.FuncOp(body=[Block(...)])` instead of `func.FuncOp(body=Region(blocks=[Block(...)]))`. So maybe also turning `Region` itself into a Sequence would be a good addition as well? Would extend the Scope of this PR, though. makslevental You suggested I make the PR, so i'm tagging you here as a potential reviewer. I hope that is ok with you. :) --------- Co-authored-by: Maksim Levental <maksim.levental@gmail.com>
Multi-Level Intermediate Representation
See https://mlir.llvm.org/ for more information.