File tree Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -221,6 +221,16 @@ The module will contain the following functionality:
221
221
dictionary. This is intended to be used for evaluating deferred attributes introduced by
222
222
:pep: `695 ` and :pep: `696 `; see below for details. *func * may be ``None ``
223
223
for convenience; if ``None `` is passed, the function also returns ``None ``.
224
+ * ``annotations_to_source(annotations: dict[str, object]) -> dict[str, str] ``: a function that
225
+ converts each value in an annotations dictionary to a string representation.
226
+ This is useful for
227
+ implementing the ``SOURCE `` format in cases where the original source is not available,
228
+ such as in the functional syntax for :py:class: `typing.TypedDict `.
229
+ * ``value_to_source(value: object) -> str ``: a function that converts a single value to a
230
+ string representation. This is used by ``annotations_to_source ``.
231
+ It uses ``repr() `` for most values, but for types it returns the fully qualified name.
232
+ It is also useful as a helper for the ``repr() `` of a number of objects in the
233
+ :py:mod: `typing ` and :py:mod: `collections.abc ` modules.
224
234
225
235
A new function is also added to the :py:mod: `!typing ` module, ``typing.evaluate_forward_ref ``.
226
236
This function is a wrapper around the ``ForwardRef.evaluate `` method, but it performs
You can’t perform that action at this time.
0 commit comments