yaml12: native Yaml wrapper + tag/formatting polish #7
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR keeps the public Python API (
parse_yaml,read_yaml,format_yaml,write_yaml) intact, but refactors the tagged-wrapper type and tightens tag + formatting behavior/perf.yaml12.Yamlis now a native Rustpyclass: immutable.value/.tag, hashable, picklable, and proxies mapping/sequence operations when wrapping collections/keys.Yaml; core scalar tags (!!str/!!int/!!float/!!bool/!!null/!!seq/!!map) normalize to plain Python values, while informative core tags (e.g.!!timestamp,!!binary) stay tagged unless handled.!foo/foo, verbatim!<...>and%TAG-expanded URIs, and core shorthand!!timestamp/!!binary.parse_yamlacceptsstror any iterable ofstrchunks (concatenated exactly; no implicit newline insertion).format_yamlround-trips float edge cases (1.0,-0.0,inf,-inf,nan), drops core scalar tags on emit, and rejectsbytes/bytearrayinputs (usestr+ tags/handlers for binary data).Yamland compare/hash structurally (including mapping insertion order) so they can round-trip safely.format_yamlborrows Pythonstrvalues zero-copy during conversion, and handler lookups are cached.py-yaml12.