>>> from amaranth import *
>>> from amaranth.lib import enum
>>> class Foo(enum.Enum, shape=unsigned(1)):
...   A = 1
...
>>> Shape.cast(Foo)
unsigned(1)