-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Update format parsing to support f-strings and the str.format function #7895
base: main
Are you sure you want to change the base?
Conversation
This comment has been minimized.
This comment has been minimized.
@clavedeluna Will you also work on fixing the tests? Otherwise it doens't make a lot of sense to keep this PR open. |
Of course. What would be the point of this PR otherwise? The following work needs to happen:
Typing is the first thing I think but I haven't had the energy to work on it much yet. If anyone is interested in contributing, please feel free to push commits. |
I'd focus on the tests first. The original PR never got the test suite to pass so there might be crucial incompatible changes in here. Typing of those change might become redundant after the incompatibilities have been fixed. |
6fdaf9f
to
39d23e3
Compare
I can now see why this was so difficult to get right in the first place. I did quite a bit but there are two tests that fail, and in trying to fix them so many other things break. @DanielNoord maybe I won't be able to complete this, but I did find a couple functional tests that I'm not sure are right. In string_formatting.py:
shouldn't those two lines emit some message, given that |
@clavedeluna Which messages were you thinking of? |
Given this
I would expect
to also raise |
Sorry for the late response, but I agree. That seems to make sense to me. |
ac4c5b2
to
2c5c9fe
Compare
if len(value.format_spec.values) == 0: | ||
continue | ||
|
||
def convert_node_to_string(x): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
move this func out for performance
and not arg_matches_format_type(arg_type, format_type) | ||
): | ||
self.add_message( | ||
"bad-string-format-type", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
try to dedupe with above code
@@ -634,6 +846,51 @@ def _check_new_format_specifiers( | |||
# can't check further if we can't infer it | |||
break | |||
|
|||
for position, specifiers in pos_args.items(): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
try to dedupe with above code
3c60fce
to
05f6e01
Compare
for more information, see https://pre-commit.ci
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## main #7895 +/- ##
==========================================
- Coverage 95.75% 95.25% -0.50%
==========================================
Files 173 176 +3
Lines 18648 18751 +103
==========================================
+ Hits 17856 17861 +5
- Misses 792 890 +98
|
This comment has been minimized.
This comment has been minimized.
I'm thinking that the two primer reports are false positives but the one in music21 seems that it may be really hard to fix because |
I think for music21 bools can be considered as |
I'm going to open this PR up for taking over since I just can't find the time to come back to it. Here is what I believe remains to be done:
|
Type of Changes
Description
This PR takes over #6555 in hopes of getting the work merged.
Closes #6163
Closes #6085