diff mbox series

[06/13] lib/oe/data: improve docstring for typed_value

Message ID 20261116-oe-lib-docstrings-v1-6-0c894f6a1064@bootlin.com
State New
Headers show
Series Improve or add oe.* library docstrings | expand

Commit Message

Antonin Godard Nov. 16, 2026, 4:09 p.m. UTC
Improve the docstring of oe.data.typed_value() with an example and
details about its parameters.

Signed-off-by: Antonin Godard <antonin.godard@bootlin.com>
---
 meta/lib/oe/data.py | 28 ++++++++++++++++++++++++++--
 1 file changed, 26 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/meta/lib/oe/data.py b/meta/lib/oe/data.py
index 37121cfad2..e9ca87dc16 100644
--- a/meta/lib/oe/data.py
+++ b/meta/lib/oe/data.py
@@ -8,8 +8,32 @@  import json
 import oe.maketype
 
 def typed_value(key, d):
-    """Construct a value for the specified metadata variable, using its flags
-    to determine the type and parameters for construction."""
+    """
+    Construct a value for the specified metadata variable, using its flags
+    to determine the type and parameters for construction.
+
+    For example, consider the following definition for ``FOO``::
+
+        FOO = "\\
+            /path/to/one \\
+            /path/to/two \\
+            /path/to/three \\
+        "
+        FOO[type] = "list"
+
+    Then this value can be iterated as follows:
+
+    .. code-block:: python
+
+       for line in oe.data.typed_value("FOO", d):
+           # ...
+
+    Take ``key`` as the variable name and return the object, for which the
+    type depends on the ``type`` variable flag of the variable.
+
+    See :py:mod:`oe.types` for more information on OpenEmbedded types.
+    """
+
     var_type = d.getVarFlag(key, 'type')
     flags = d.getVarFlags(key)
     if flags is not None: