Skip to content

Conversation

@gerlero
Copy link
Owner

@gerlero gerlero commented Dec 1, 2025

No description provided.

@gerlero gerlero force-pushed the files branch 5 times, most recently from cd5c9e7 to d8f1196 Compare December 3, 2025 20:21
@gerlero gerlero requested a review from Copilot December 3, 2025 20:22
Copilot finished reviewing on behalf of gerlero December 3, 2025 20:26
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR improves serialization by separating normalization and serialization logic into distinct functions. The main change introduces a new normalize() function that converts Python data types into normalized internal representations before serialization, and a new parse() function that provides targeted parsing for specific types.

  • Introduction of normalize() function with comprehensive pattern matching for different data types
  • New parse() function for type-specific parsing (tokens, data, standalone data, files)
  • Refactored dumps() function to work with pre-normalized data
  • Updated grammar to export TOKEN, DATA, STANDALONE_DATA, and LOCATED_FILE

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/foamlib/_files/_serialization.py Major refactor: added normalize() function with pattern matching for all data types, updated dumps() to work with normalized data, replaced bool_ok parameter with force_token
src/foamlib/_files/_parsing/parsed.py Added new parse() function for type-specific parsing, updated Parsed class to use new grammar names
src/foamlib/_files/_parsing/_grammar.py Exported grammar elements as public (TOKEN, DATA, STANDALONE_DATA, LOCATED_FILE) for use in new parse function
src/foamlib/_files/_parsing/init.py Added parse function to public API
src/foamlib/_files/files.py Updated to use new parse() function instead of Parsed class, changed bool_ok parameter to force_token in normalize calls
tests/test_files/test_dumps.py Updated all tests to explicitly call normalize() before dumps(), demonstrating the new two-step serialization process

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@gerlero gerlero merged commit 0fd3965 into main Dec 3, 2025
35 checks passed
@gerlero gerlero deleted the files branch December 3, 2025 20:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants