Add FString support to binary like formatting

## Summary

This is the last part of the string - binary like formatting. It adds support for handling fstrings the same as "regular" strings.


## Test Plan

I added a test for both binary and comparison. 

Small improvements across several projects

**This PR**
| project      | similarity index  | total files       | changed files     |
|--------------|------------------:|------------------:|------------------:|
| cpython      |           0.76083 |              1789 |              1632 |
| django       |           0.99966 |              2760 |                58 |
| **transformers** |           0.99929 |              2587 |               454 |
| twine        |           1.00000 |                33 |                 0 |
| typeshed     |           0.99978 |              3496 |              2173 |
| **warehouse**    |           0.99825 |               648 |                22 |
| **zulip**        |           0.99950 |              1437 |                27 |


**Base**

| project      | similarity index  | total files       | changed files     |
|--------------|------------------:|------------------:|------------------:|
| cpython      |           0.76083 |              1789 |              1632 |
| django       |           0.99966 |              2760 |                58 |
| transformers |           0.99928 |              2587 |               454 |
| twine        |           1.00000 |                33 |                 0 |
| typeshed     |           0.99978 |              3496 |              2173 |
| warehouse    |           0.99824 |               648 |                22 |
| zulip        |           0.99948 |              1437 |                28 |


<!-- How was it tested? -->
This commit is contained in:
Micha Reiser 2023-09-08 11:48:57 +02:00 committed by GitHub
parent 05951dd338
commit 41f0aad7b3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 100 additions and 43 deletions

View file

@ -90,6 +90,15 @@ self._assert_skipping(
+ x
)
(
b + c + d +
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
f"bbbbbb{z}bbbbbbbbbbbbbbbbbbbbbbb"
"cccccccccccccccccccccccccc"
% aaaaaaaaaaaa
+ x
)
(
b < c > d <
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
@ -266,6 +275,12 @@ self._assert_skipping(
"cccccccccccccccccccccccccc" % aaaaaaaaaaaa + x
)
(
b + c + d + "aaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
f"bbbbbb{z}bbbbbbbbbbbbbbbbbbbbbbb"
"cccccccccccccccccccccccccc" % aaaaaaaaaaaa + x
)
(
b < c > d < "aaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
"bbbbbbbbbbbbbbbbbbbbbbbbbbbbb"

View file

@ -137,6 +137,15 @@ assert (
in caplog.messages
)
(
b < c > d <
f"aaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
"bbbbbbbbbbbbbbbbbbbbbbbbbbbbb"
"cccccccccccccccccccccccccc"
% aaaaaaaaaaaa
> x
)
c = (a >
# test leading binary comment
"a" "b" * b
@ -356,6 +365,12 @@ assert (
"be silently ignored by the index" in caplog.messages
)
(
b < c > d < f"aaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
"bbbbbbbbbbbbbbbbbbbbbbbbbbbbb"
"cccccccccccccccccccccccccc" % aaaaaaaaaaaa > x
)
c = (
a >
# test leading binary comment