Add incredibly naive ENSV Reader and Writer#3
Merged
Conversation
Metadata (inert config): columns, types, bool sentinels, table width, unknown forms. Parses from/serializes to lifted metadata rows. ENSVReader: reusable stateful converter with settable .meta property. read() yields converted rows lazily with width validation. peel(): consume one element from an iterator, return (Metadata, tail). read(): one-shot convenience returning iterator with .meta attribute. encode(): metadata + data -> seqseq for nsv.dumps. https://claude.ai/code/session_018keUYHFdMPKVUXkfE4LdCs
- Remove __eq__/__repr__ from UnknownForm (test concern, not live code) - Split overloaded table field into table (bool) + width (int|None) - Compare unknown forms by fields in Metadata.__eq__ https://claude.ai/code/session_018keUYHFdMPKVUXkfE4LdCs
Remove Metadata, ENSVReader, type conversion, encode, and all associated machinery. The module now exports lift, unlift, and peel. peel consumes one row from an iterator and returns (seqseq, tail). https://claude.ai/code/session_018keUYHFdMPKVUXkfE4LdCs
split: find first empty row, return (meta seqseq, offset, data). join: inverse of split, concatenates meta + empty row + data. Aligns with spec's spill[Seq[String], []] for metadata separation. https://claude.ai/code/session_018keUYHFdMPKVUXkfE4LdCs
Reader: consumes meta rows until empty row separator, exposes .meta, then yields data rows on iteration. Writer: write_meta() writes forms + empty row, then write_row()/write_rows() for data, delegating to NSV Writer. https://claude.ai/code/session_018keUYHFdMPKVUXkfE4LdCs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
No interpretation of metadata, only storage. Doesn't handle the case where the metadata is not fully available from the outset. Does not handle finalization. Forces metadata writing onto the user. Maybe I should focus on methods extracting and encoding metadata as a seqseq? But then, the classes make it more convenient if the user doesn't need that level of control. Anyway, would do for now.