load_yaml: Document block-list form of optional marker

The optional marker is a leading dash in the include spec, but in
a YAML block list the leading dash is the list syntax and is
consumed by the YAML parser before load_yaml() sees the spec.  An
include written as a plain list item "- file" is therefore
required, not optional, and a missing file raises, even though the
dash reads like the optional marker.

Note in the module docstring that in a block list the item itself
must carry the marker, as in "- -file.yaml" or the quoted form
"- "-file.yaml"".

Assisted-by: unsloth/Qwen3.8-27B-GGUF:Q4_K_M with pi.dev v0.84.2
Signed-off-by: Jan Lindemann <jan@janware.com>
This commit is contained in:
Jan Lindemann 2026-08-25 20:09:55 +02:00
commit 14a0ba4174
Signed by: Jan Lindemann
GPG key ID: 3750640C9E25DD61

View file

@ -6,7 +6,9 @@ supports three extensions:
- ``jw.include`` — deep-merges other YAML files into the document,
either at the root or at a dot-separated target path. A leading
``-`` marks the include as optional (a missing file contributes
nothing). File names may use glob characters (``*``, ``?``,
nothing). In a YAML block list the list dash is not the marker;
the item itself must carry it, as in ``- -file.yaml`` or
``- "-file.yaml"``. File names may use glob characters (``*``, ``?``,
``[...]``); all matches are included in lexical order, and a
non-optional glob that matches no files raises ValueError. A spec
that starts with a glob character such as ``*`` or ``[`` must be