Skip to content

Review - #386

Merged
dimbleby merged 9 commits into
mainfrom
review
Nov 28, 2026
Merged

Review#386
dimbleby merged 9 commits into
mainfrom
review

Conversation

@dimbleby

Copy link
Copy Markdown
Owner

No description provided.

dimbleby and others added 9 commits November 28, 2026 12:11
None of IntegerValue, FloatValue, BoolValue, or DateTimeValue were
ever checked by type, and StringValue had a single check in _format.py.
Dropping the five fieldless subclasses simplifies Value, removes
generic boilerplate, avoids throwaway ScalarValue allocation when
scanning quoted keys, and lets _canon_value return early for scalars.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: e943f73b-5c95-4409-8a90-50d0a84ad054
Replace the type(self) switch in Slot.__deepcopy__ with polymorphic
overrides on KVSlot and StructuralHeaderSlot, matching render() so each
subclass keeps its copy logic alongside its slots and __init__.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: e943f73b-5c95-4409-8a90-50d0a84ad054
CommaItem, InlineTableEntry, and CommaValue previously called
copy.deepcopy on every trivia string, boolean flag, and key tuple,
unlike Slot.__deepcopy__ which shares them directly. Sharing immutable
fields directly removes redundant deepcopy calls (~56% faster on
test_clone_section_with_inline_value, ~28% faster on formatted-table
copies) while keeping full isolation for items, nested values, and
mutable scalar payloads.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: e943f73b-5c95-4409-8a90-50d0a84ad054
Replace the character-by-character loops in _format._literal_eligible
and _scanner.skip_inline_ws with compiled regexes, matching the
surrounding style in both modules.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: e943f73b-5c95-4409-8a90-50d0a84ad054
Share slice-assignment preparation between Array.__setitem__ and
AoT.__setitem__, normalise AoT integer indices at the AoT boundary,
and pass already-normalised ranges into assign_aot_entries so slices
are only normalised once. Remove the redundant _norm_aot_index and
remove_aot_entry wrappers from _layout_ops.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: e943f73b-5c95-4409-8a90-50d0a84ad054
Replace reorder_container with sort_container so attached section
sorting walks owned_slots once to both partition keys into
pure-leaf / mixed / pure-section groups and collect movable slots,
avoiding the prior binding_refs scan. Remove the now-redundant
detached guard in binding_refs.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: e943f73b-5c95-4409-8a90-50d0a84ad054
Promote _layout_ops._separator_end to _trivia.separator_end so
_format._canon_leading can reuse it instead of splitting and rejoining
lines. Replace the single use of split_above_block in _format with
split_eol_section + leading_break and remove split_above_block and
_pad_above_from.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: e943f73b-5c95-4409-8a90-50d0a84ad054
Inline _file_synthetic_header_and_kv into its sole remaining caller
(_synthesise_header_then_insert_kv) and drop the unused capture
parameter on add_aot_entry.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: e943f73b-5c95-4409-8a90-50d0a84ad054
- Replace 10 deferred _container imports in _array.py and _layout_ops.py
  with attribute access on the already-imported _container module.
- Drop unused return values on _assemble_document, _validate_comment_str,
  adopt_private_block, adopt_private_implicit, and clone_implicit_section.
- Remove always-passed defaults on internal helpers and prune 5 unused
  entries from internal __all__ lists.
- Narrow _prepare_slice_assignment's target parameter from Sequence[Any]
  to Sequence[object].

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: e943f73b-5c95-4409-8a90-50d0a84ad054
@dimbleby
dimbleby merged commit 7d8fa2d into main Nov 28, 2026
12 checks passed
@dimbleby
dimbleby deleted the review branch November 28, 2026 13:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant