-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Handle %s strings with length and alignment (#194)
* Handle %s strings with length and alignment %s format strings allow for padding and alignment, but their behaviour is very different from fstrings. %20s will pad a string to 20 characters, and right align %-20s will pad a string to 20 characters, and left align This behaviour is carried over from the C *printf() functions. This patch adds the ability to properly convert these to fstrings, using the correct alignment markers. The feature is gated behind aggressive mode for now. The earlier code did already convert %20s, but changed the alignment (the resulting fstring would be left aligned instead of right), and did not understand %-20s at all. * Update src/flynt/transform/percent_transformer.py --------- Co-authored-by: Ralf Ertzinger <[email protected]> Co-authored-by: Ilya Kamen <[email protected]>
- Loading branch information
1 parent
10c2235
commit 30df63b
Showing
2 changed files
with
45 additions
and
1 deletion.
There are no files selected for viewing
This file contains 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
This file contains 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