Skip to content

Commit 9281d19

Browse files
docs: refine two-phase flow-sequence comment in sync()
1 parent ca00e25 commit 9281d19

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

src/yamltrip/document.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -472,11 +472,11 @@ def sync(self, *keys: KeyPart, value: Any) -> Document:
472472
#
473473
# Phase 1 (_flow_seq_replacements) pre-converts only the flow sequences
474474
# that will be modified. A full replace at a higher path would
475-
# re-serialise the whole mapping with 2-space indentation, losing the
476-
# document's existing indent for nested lists.
475+
# re-serialize the whole mapping with the default indentation, losing
476+
# the document's existing indent for nested lists.
477477
#
478478
# Phase 2 (except PatchError below) catches cases phase 1 misses. The
479-
# main gap is list reordering: new indices in the diff weren't in the
479+
# known gap is list reordering: new indices in the diff weren't in the
480480
# original tree, so phase 1 couldn't anticipate them.
481481
doc: Document = self
482482
flow_patches = _flow_seq_replacements(
@@ -496,7 +496,8 @@ def sync(self, *keys: KeyPart, value: Any) -> Document:
496496
if _classify_patch_error(e) != _PatchErrorKind.BLOCK_SEQUENCE_EXPECTED:
497497
raise
498498
# Fallback: a flow sequence was missed by pre-detection (e.g. due to
499-
# list reordering). Replace the entire synced value.
499+
# list reordering). Full replace from original doc; phase 1 work
500+
# is superseded.
500501
route = _make_route(normalized)
501502
op = Op.replace(value)
502503
return self._apply_patches([Patch(route=route, operation=op)])

0 commit comments

Comments
 (0)