Skip to content

Add FormattedValue f-strings #241

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 2 commits into from
Closed

Conversation

amaydixit11
Copy link

@amaydixit11 amaydixit11 commented Apr 5, 2025

Pull Request description

This PR adds a new LiteralFormattedString class for representing formatted string values (f-strings) in the AST. Instead of using the Python-specific name FormattedValue, we've chosen LiteralFormattedString to maintain consistency with our existing naming conventions for literal types.

The new class handles all the essential components of formatted strings:

  • The expression to be formatted
  • Optional format specifiers (e.g., .2f)
  • Optional conversion flags (!s, !r, !a)

This implementation allows for proper representation of f-string expressions in our AST.

Solves #202

How to test these changes

  • Run the new unit tests: pytest tests/datatypes/test_char_string.py -xvs
  • Create a formatted string using the new class and visualize its AST representation

Pull Request checklists

This PR is a:

  • bug-fix
  • new feature
  • maintenance

About this PR:

  • it includes tests.
  • the tests are executed on CI.
  • the tests generate log file(s) (path).
  • pre-commit hooks were executed locally.
  • this PR requires a project documentation update.

Author's checklist:

  • I have reviewed the changes and it contains no misspelling.
  • The code is well commented, especially in the parts that contain more
    complexity.
  • New and old tests passed locally.

@xmnlab
Copy link
Contributor

xmnlab commented Apr 6, 2025

@amaydixit11 please fix the issues raised in the CI

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 Apr 11, 2025
@xmnlab
Copy link
Contributor

xmnlab commented Apr 13, 2025

I am closing this PR because it was labeled as staled.
thanks @amaydixit11 , feel free to reopen it if you want to work on that again.

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