@@ -1300,30 +1300,30 @@ These can be used as types in annotations using ``[]``, each having a unique syn
1300
1300
where ``T1``, ``T2``, etc. are :class:`TypeVars <TypeVar>`. This would be
1301
1301
invalid: only one type should be passed to Annotated.
1302
1302
1303
- * By default, :func: `get_type_hints ` strips the metadata from annotations.
1304
- Pass ``include_extras=True `` to have the metadata preserved:
1303
+ * By default, :func: `get_type_hints ` strips the metadata from annotations.
1304
+ Pass ``include_extras=True `` to have the metadata preserved:
1305
1305
1306
- .. doctest ::
1307
-
1308
- >>> from typing import Annotated, get_type_hints
1309
- >>> def func (x : Annotated[int , " metadata" ]) -> None : pass
1310
- ...
1311
- >>> get_type_hints(func)
1312
- {'x': <class 'int'>, 'return': <class 'NoneType'>}
1313
- >>> get_type_hints(func, include_extras = True )
1314
- {'x': typing.Annotated[int, 'metadata'], 'return': <class 'NoneType'>}
1315
-
1316
- * At runtime, the metadata associated with an ``Annotated `` type can be
1317
- retrieved via the :attr: `!__metadata__ ` attribute:
1306
+ .. doctest ::
1318
1307
1319
- .. doctest ::
1320
-
1321
- >>> from typing import Annotated
1322
- >>> X = Annotated[int , " very" , " important" , " metadata" ]
1323
- >>> X
1324
- typing.Annotated[int, 'very', 'important', 'metadata']
1325
- >>> X.__metadata__
1326
- ('very', 'important', 'metadata')
1308
+ >>> from typing import Annotated, get_type_hints
1309
+ >>> def func (x : Annotated[int , " metadata" ]) -> None : pass
1310
+ ...
1311
+ >>> get_type_hints(func)
1312
+ {'x': <class 'int'>, 'return': <class 'NoneType'>}
1313
+ >>> get_type_hints(func, include_extras = True )
1314
+ {'x': typing.Annotated[int, 'metadata'], 'return': <class 'NoneType'>}
1315
+
1316
+ * At runtime, the metadata associated with an ``Annotated `` type can be
1317
+ retrieved via the :attr: `!__metadata__ ` attribute:
1318
+
1319
+ .. doctest ::
1320
+
1321
+ >>> from typing import Annotated
1322
+ >>> X = Annotated[int , " very" , " important" , " metadata" ]
1323
+ >>> X
1324
+ typing.Annotated[int, 'very', 'important', 'metadata']
1325
+ >>> X.__metadata__
1326
+ ('very', 'important', 'metadata')
1327
1327
1328
1328
.. seealso ::
1329
1329
0 commit comments