Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(ini): allow custom parsers/serializers for ini options #2332

Merged
merged 10 commits into from
Feb 10, 2025

Conversation

sylvlecl
Copy link
Member

@sylvlecl sylvlecl commented Feb 6, 2025

Adds the possibility to define custom parsing and serialization for specific INI options.

Will be used for "group" attribute of clusters etc. in future work.

Also moves INI-related features to a new module dedicated to serialization and deserialization, antarest.core.serde.
(hence the many modified files)

antarest/study/storage/rawstudy/ini_reader.py Outdated Show resolved Hide resolved
antarest/study/storage/rawstudy/ini_reader.py Outdated Show resolved Hide resolved
antarest/study/storage/rawstudy/ini_reader.py Outdated Show resolved Hide resolved
antarest/study/storage/rawstudy/ini_writer.py Outdated Show resolved Hide resolved
ValueSerializer = Callable[[str], PrimitiveType]


def _lower_case(input: str) -> str:
Copy link
Contributor

Choose a reason for hiding this comment

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

This also exists inside the ini_reader, we could import it or put this inside the utility file

Copy link
Member Author

Choose a reason for hiding this comment

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

I slightly prefer to keep it separate because it has 2 different usages (parsing and serializing)

MartinBelthle
MartinBelthle previously approved these changes Feb 10, 2025
Copy link
Contributor

@MartinBelthle MartinBelthle left a comment

Choose a reason for hiding this comment

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

We'll have to silent Sonar

@sylvlecl sylvlecl merged commit 1f78ca7 into dev Feb 10, 2025
12 of 14 checks passed
@sylvlecl sylvlecl deleted the feat/custom-ini-serde branch February 10, 2025 16:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants