with extra annotations. The alias behaves like a normal typing alias,
instantiating is the same as instantiating the underlying type, binding
it to types is also the same.
+
+ The metadata itself is stored in a '__metadata__' attribute as a tuple.
"""
def __init__(self, origin, metadata):
if isinstance(origin, _AnnotatedAlias):
Details:
- It's an error to call `Annotated` with less than two arguments.
+ - Access the metadata via the ``__metadata__`` attribute::
+
+ Annotated[int, '$'].__metadata__ == ('$',)
+
- Nested Annotated are flattened::
Annotated[Annotated[T, Ann1, Ann2], Ann3] == Annotated[T, Ann1, Ann2, Ann3]