Skip to content

feat: Add FormattedValue support for f-string formatting #218

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

Closed
wants to merge 1 commit into from

Conversation

SanjayUG
Copy link

@SanjayUG SanjayUG commented Mar 17, 2025

Title

feat: Add FormattedValue support for f-string formatting

Description

What is this PR

  • Addition of a new feature

Why is this PR needed?

This PR is needed to enhance the functionality of f-string formatting by adding support for formatted values, which allows for more flexible and powerful string formatting.

What does this PR do?

This PR introduces the following changes:

  • Adds FormattedValueKind to the ASTKind enum.
  • Implements the FormattedValue class for handling f-string formatted values.
  • Adds transpiler support for formatted values.
  • Adds test cases to ensure correct handling of formatted values.

References

#202

How has this PR been tested?

New test cases have been added to cover the handling of formatted values in f-strings. These tests ensure that the new functionality works as expected and that no existing functionality has been affected.

Is this a breaking change?

This PR does not break any existing functionality. It only adds new functionality for f-string formatted values.

Does this PR require an update to the documentation?

Yes, the documentation has been updated to reflect the changes and the addition of the new feature.

Checklist:

  • The code has been tested locally
  • Tests have been added to cover all new functionality
  • The documentation has been updated to reflect any changes
  • The code has been formatted with pre-commit

@xmnlab
Copy link
Contributor

xmnlab commented Mar 17, 2025

Hi @SanjayUG , thanks for working on that!
Instead of FormattedValue, it would be better if we call it as LiteralFormattedString, we don't need to keep the same name used by Python, and it would be better to keep the consistency with the other classes.

Copy link

This pull request has been marked as stale because it has been
inactive for more than 5 days. Please update this pull request
or it will be automatically closed in 5 days.

@github-actions github-actions bot added the Stale label Mar 23, 2025
@SanjayUG
Copy link
Author

Hi @SanjayUG , thanks for working on that! Instead of FormattedValue, it would be better if we call it as LiteralFormattedString, we don't need to keep the same name used by Python, and it would be better to keep the consistency with the other classes.

Thank You for the feedback, I would be sighting it.

@github-actions github-actions bot removed the Stale label Mar 26, 2025
Copy link

This pull request has been marked as stale because it has been
inactive for more than 5 days. Please update this pull request
or it will be automatically closed in 5 days.

@github-actions github-actions bot added the Stale label Mar 31, 2025
@xmnlab
Copy link
Contributor

xmnlab commented Apr 2, 2025

closing this pr as stale. @SanjayUG if you still want to work on that, please ping us on discord to check if no one else has started to work on that.
thanks

@xmnlab xmnlab closed this Apr 2, 2025
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